package com.zhl.study.controller;

import com.zhl.study.Entity.Shop;
import com.zhl.study.base.ResponseFactory;
import com.zhl.study.base.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
* @description  校验
* @Author: z156940l@outlook.com
* @className TestController
* @Date: 2023/4/28 10:30
*/
@RestController
@RequestMapping("api/")
@Api(value = "参数校验", tags = "参数校验")
public class TestController {

    @PostMapping("/saveShop")
    @ApiOperation(httpMethod = "POST", value = "jsr303校验")
    public Result<Void> saveShop(@Valid @RequestBody Shop shop){
        return ResponseFactory.ok();
    }

//    @PostMapping("/testArrayVal")
//    @ApiOperation(httpMethod = "POST", value = "jsr303使用自定义注解校验")
//    public Result<Void> testArrayVal(@Valid @ArrayVal(value = {1,0}, message = "字段必须为1或者0") @RequestParam int status){
//        return ResponseFactory.ok();
//    }
}
